import React, { LegacyRef } from 'react'
import { Provider, data } from './store'
import Car from './components/car'
import Car1 from './components/car1'
export default class App extends React.Component<{}, { list: any[], addList: (value) => void }> {
	addList: (value) => void
	btns: React.ReactNode
	qwe: React.ReactNode
	h1: LegacyRef<HTMLHeadingElement>

	constructor(props) {
		super(props)

		this.addList = (value) => {
			this.setState({
				list: [...this.state.list, value]
			})
		}

		this.state = {
			list: data.list,
			addList: this.addList
		}

		this.h1 = React.createRef()

	}

	render() {
		return (
			<div>
				<Provider value={this.state}>
					<Car ref={ ref => this.qwe = ref }></Car>
					<Car1></Car1>

					<button ref={ ref => this.btns = ref }>求获取btn</button>
					<h1 ref={ this.h1 }>1231231231</h1>

				</Provider>
			</div>
		)
	}

	componentDidMount() {
		console.log(this.btns);
		console.log(this.qwe);
		
	
	}
}